package cn.hp.customer.controller;

import cn.hp.customer.service.CustomerPhoneService;
import cn.hp.customer.util.ResponseData;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/customerPhone")
public class CustomerPhoneController {

    @Autowired
    private CustomerPhoneService customerPhoneService ;

    @RequestMapping("/main")
    public String mainPage(){
        return "/WEB-INF/customer/main.html";
    }

    @ResponseBody
    @RequestMapping("/orderMoney")
    public String orderMoney(String dis){
        System.out.println("----------------");
        System.out.println(dis);
        ResponseData responseData = customerPhoneService.calculatedAmount(dis);
        return JSON.toJSONString(responseData);
    }
}
